/**
 * Copyright [2020] [LiBo/Alex of copyright liboware@gmail.com ]
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.hyts.gateway.base.enums;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
 * @project-name:gateway
 * @package-name:com.hyts.gateway.base.bean.result
 * @author:LiBo/Alex
 * @create-date:2020-12-20 10:26
 * @copyright:libo-alex4java
 * @email:liboware@gmail.com
 * @description: 返回结果操作结果体
 */
@Accessors(chain = true)
@NoArgsConstructor
public enum ResultCodeEnum implements ConstantEnum<Integer, Object> {

    /**
     * 成功.
     */
    SUCCESS(Boolean.TRUE, 200, "执行成功", null),

    /**
     * 失败(UNKNOWN_ERROR_CODE)
     */
    UNKNOWN_ERROR_CODE(Boolean.FALSE, 500, "执行失败", null),

    /**
     * 数据已存在
     */
    DATA_ALREADY_EXISTS(Boolean.FALSE, 500, "数据已存在", null),

    /**
     * 没有查到数据
     */
    DATA_NOT_FOUND(Boolean.FALSE, 500, "没有查到数据", null),

    /**
     * 参数校验不正确
     */
    PARAMTER_ERROR_CODE(Boolean.FALSE, 500, "参数校验不正确", null),

    /**
     * 参数不允许为空
     */
    PARAMTER_NULL_CODE(Boolean.FALSE, 500, "参数不允许为空", null),

    ;

    /**
     * 数据成功状态
     */
    @Getter
    private boolean success;

    /**
     * 编码
     */
    private Integer code;

    /**
     * 信息内容
     */
    @Getter
    @Setter
    private String message;

    /**
     * 数据对象值
     */
    @Setter
    private Object value;


    /**
     * 私有构造器
     *
     * @param success
     * @param code
     * @param message
     * @param value
     */
    ResultCodeEnum(boolean success, Integer code, String message, Object value) {
        this.success = success;
        this.code = code;
        this.message = message;
        this.value = value;
    }

    @Override
    public Integer getCodeByValue(Object o) {
        return null;
    }

    @Override
    public Object getValueByCode(Integer integer) {
        return null;
    }

    @Override
    public Integer code() {
        return code;
    }

    @Override
    public Object value() {
        return value;
    }


}
